package com.jingyuan.client;

import com.jingyuan.common.entity.utils.PropertyReadUtil;


public class PropertiesUtil {
    private String hostAddress ="";
    private Integer port =null;
    private String serverAddress="";
    private Integer serverPort=null;

    private PropertyReadUtil readUtil;
    private static PropertiesUtil util=new PropertiesUtil();

    private PropertiesUtil(){
        readUtil=new PropertyReadUtil("harmonyclient.properties");
    }

    public static PropertiesUtil getPropertiesUtil(){
        return util;
    }
    public String getHostAddress(){
        if(hostAddress.isEmpty()){
            hostAddress =readUtil.getProperty("hostAddress");
        }
        return hostAddress;
    }

    public int getPort(){
        if(port ==null){
            port =Integer.valueOf(readUtil.getProperty("port"));
        }
        return port;
    }

    public String getServerAddress() {
        if(serverAddress.isEmpty()){
            serverAddress=readUtil.getProperty("serverAddress");
        }
        return serverAddress;
    }

    public Integer getServerPort() {
        if(serverPort==null){
            serverPort=Integer.valueOf(readUtil.getProperty("serverPort"));
        }
        return serverPort;
    }
}
